import { Image, StyleSheet, View } from 'react-native';
import React from 'react';

const styles = StyleSheet.create({
    commentStars:{
     flexDirection:'row',
    }
  });

function getStar(item,size){

    if(!item.rating){
      return (
        <View key={item.id+"-null"}></View>
      )
    }

    let stars = parseInt(item.rating.star_count);
    let list = [];
    for(let i=0;i<5;i++){

      if(i<stars)
      {
        list.push(<Image key={item.id+'-'+i} source={{
          uri: '',
          width:size,
          height:size
        }} />)
      }
      else
      {
        list.push(<Image key={item.id+'-'+i} source={{
          uri: '',
          width:size,
          height:size
        }} />);
      }
    }

    return <View style={styles.commentStars}>{list}</View>
  }

  export default getStar;